<span xmlns:py="http://purl.org/kid/ns#">
	<span py:def="get_script()">
	  <div name="${dom_id}"
       id="${dom_id}"
       style="width:620px;
              height:480px;">
    </div>

		<script type="text/javascript" >
		var map;
		var kml;
		function ${load_func}(){
		  if (GBrowserIsCompatible()) {
		    map = new GMap2($$('${dom_id}'));
		    map.addControl(new GSmallMapControl());
		    map.addControl(new GMapTypeControl());
		    map.setCenter(new GLatLng(${center_lat}, ${center_lng}), ${zoom});
		    var kml_url = "${value_of('kml_url','')}";
		    if (kml_url) {
		    kml = new GGeoXml(kml_url);
		    if (kml.loadedCorrectly())
		      map.addOverlay(kml);
		     else {
		        GDownloadUrl(kml_url, function (data, responseCode)
		          {
		            var xml = GXml.parse(data);
		            var places = xml.documentElement.getElementsByTagName("Placemark");
		            for (var i = 0; i!=places.length; i++)
		            {
		              var name = GXml.value(places[i].getElementsByTagName("name")[0])
		              var params = { name:name,
		                                        title:name
		                                      };
		              var description = GXml.value(places[i].getElementsByTagName("description")[0])
		              var coords = GXml.value(places[i].getElementsByTagName("coordinates")[0]).split(",");
		              var point = new GLatLng(parseFloat(coords[0]), parseFloat(coords[1]));
		              var marker =  new GMarker(point, params);
		              marker.description = description;
		              GEvent.addListener(marker, "click", function() {
		                this.openInfoWindowHtml(this.description);
		              });
		              map.addOverlay(marker);
		            }
		          });
		    }
		    }
		  }else {
		    alert("Sorry, the Google Maps API is not compatible with this browser.");
		  }
		}
		</script>

	</span>

	${get_script()}

</span>
